package com.best.oasis.settlement.dao.exception;

import java.util.ArrayList;
import java.util.List;
/**
 * 数据访问层exception，支持将多个参数传递到前层，构造成用户方便追踪原因的message。
 * @author bl00064
 *
 */
public class DaoException extends RuntimeException{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * 构造错误信息的参数
	 */
	private List<String> parms ;
	/**
	 * 错误信息代码，用做与i18n关联
	 */
	private String errorcode;
	/**
	 * 错误消息.
	 */
	private String message;
	
	public DaoException(String errorcode){
		super();
		this.errorcode = errorcode;
	}
	public DaoException(String errorcode,String message){
		super(message);
		this.errorcode = errorcode;
		this.message = message;
	}
	public DaoException(String errorcode,Throwable cause){
		super(cause);
		this.errorcode = errorcode;
	}
	
	public DaoException(String errorcode, String messsage,String parameter){
		super(messsage);
		this.errorcode = errorcode;
		addParameter(parameter);
	}
	
	public void addParameter(String parameter){
		if(parms == null)
			parms = new ArrayList<String>();
		parms.add(parameter);
	}
	
	public List<String> getParameters(){
		return parms;
	}
	public List<String> getParms() {
		return parms;
	}
	public void setParms(List<String> parms) {
		this.parms = parms;
	}
	public String getErrorcode() {
		return errorcode;
	}
	public void setErrorcode(String errorcode) {
		this.errorcode = errorcode;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}

}
